﻿using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using System.ComponentModel;

namespace Modules.Project.Entitys
{
    /// <summary>
    /// 劳务班组
    ///</summary>
    [TableName("project_group")]
    [Description("项目劳务班组信息")]
    [PrimaryKey("group_id", AutoIncrement = true)]
    [CacheSetting(true, PropertyNamesOfArea = "ProjectId")]
    [Serializable]
    public class ProjectGroup : IDelEntity
    {
        /// <summary>
        /// 班组ID
        ///</summary>
        [Column("group_id")]
        public int GroupId { get; set; }

        /// <summary>
        /// 项目ID
        ///</summary>
        [Column("project_id")]
        public int ProjectId { get; set; }

        /// <summary>
        /// 企业ID
        ///</summary>
        [Column("corp_id")]
        public int CorpId { get; set; }

        /// <summary>
        /// 班组名称
        ///</summary>
        [Column("name")]
        public string Name { get; set; }


        /// <summary>
        /// 创建时间
        ///</summary>
        [Column("create_time")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 进场日期
        ///</summary>
        [Column("start_date")]
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 出场日期
        ///</summary>
        [Column("end_date")]
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 是否是管理组，前端不做展示，针对现场管理人员使用
        ///</summary>
        [Column("is_manager_group")]
        public bool? IsManagerGroup { get; set; } = false;

        /// <summary>
        /// 是否已删除
        /// </summary>
        [Column("is_deleted")]
        public bool IsDeleted { get; set; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return GroupId; } }


        [Ignore]
        bool IDelEntity.IsDeletedInDatabase { get => this.IsDeleted; set => this.IsDeleted = value; }

        #endregion IEntity 成员
    }
}